package com.hibernate.daoimp.user;

import java.util.Date;
import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.hibernate.dao.user.AdminUidDao;
import com.hibernate.pojo.AdminUid;

public class AdminUidDaoImp extends HibernateDaoSupport implements AdminUidDao
{
	private boolean bool;
	public boolean checkAdminUid(AdminUid adminuid)
	{
		bool=false;
		List list=this.getHibernateTemplate().find("from AdminUid where uid='"+adminuid.getUid()+"' and pwd='"+adminuid.getPwd()+"'");
		if(list.size()>0)
		{
			//write administrators last login time
			AdminUid au=(AdminUid)list.get(0);
			au.setLastlogintime(new Date());
			this.getHibernateTemplate().update(au);
			//log on complete
			bool=true;
		}
		return bool;
	}
}
